package launch.holder;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public class PureBuffStorage {

    private final Map<Integer, List<PureBuffValueHolder>> buffs = new LinkedHashMap<Integer, List<PureBuffValueHolder>>();
    private final Map<Integer, List<PureCoolDownValueHolder>> coolDowns = new LinkedHashMap<Integer, List<PureCoolDownValueHolder>>();
    private final Map<Integer, List<PureDiseaseValueHolder>> diseases = new LinkedHashMap<Integer, List<PureDiseaseValueHolder>>();

    public final void addBuffsToStorage(final int playerId, final List<PureBuffValueHolder> toStore) {
	if (buffs.containsKey(playerId)) {
            buffs.remove(playerId);
        }
        buffs.put(playerId, toStore);
    }

    public final void addCooldownsToStorage(final int playerId, final List<PureCoolDownValueHolder> toStore) {
	if (coolDowns.containsKey(playerId)) {
            coolDowns.remove(playerId);
        }
        coolDowns.put(playerId, toStore);
    }

    public final void addDiseaseToStorage(final int playerId, final List<PureDiseaseValueHolder> toStore) {
	if (diseases.containsKey(playerId)) {
            diseases.remove(playerId);
        }
        diseases.put(playerId, toStore);
    }
    
    public final List<PureBuffValueHolder> getBuffsFromStorage(final int playerId) {
        if (buffs.containsKey(playerId)) {
            return buffs.get(playerId);
        }
        return new ArrayList<PureBuffValueHolder>();
    }

    public final List<PureCoolDownValueHolder> getCooldownsFromStorage(final int playerId) {
        if (coolDowns.containsKey(playerId)) {
            return coolDowns.get(playerId);
        }
        return new ArrayList<PureCoolDownValueHolder>();
    }

    public final List<PureDiseaseValueHolder> getDiseaseFromStorage(final int playerId) {
        if (diseases.containsKey(playerId)) {
            return diseases.get(playerId);
        }
        return new ArrayList<PureDiseaseValueHolder>();
    }
}
